package com.wellink.tabhostdemo;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TabHost;

public class MainActivity extends AppCompatActivity {

    TabHost tabHost;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.tabhost_layout);

        tabHost = findViewById(R.id.mytabhost);
//        tabHost.setup();

        tabHost.addTab(tabHost.newTabSpec("0").setIndicator("红色").setContent(R.id.widget_layout_red));;
        tabHost.addTab(tabHost.newTabSpec("1").setIndicator("绿色").setContent(R.id.widget_layout_green));
        tabHost.addTab(tabHost.newTabSpec("2").setIndicator("蓝色").setContent(R.id.widget_layout_blue));

    }
}
